package com.yyfax.pay.vo.depository;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.NotBlank;

import com.yyfax.commons.lang.DateUtil;
import com.yyfax.pay.common.exception.PayExceptionCode;

/**
 * 查询签约信息请求参数
 * 
 * @author buyi
 * @date 2018-06-21 10:09:59
 * @since v2.2.2
 */
public class QueryUserProtocolSignReq {

	/** 用户id  */
	@NotBlank(message = "userId不能为空")
	private String userId;

	/**  身份证号 */
	@NotBlank(message = "idNo不能为空")
	private String idNo;

	private String signDate;

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getIdNo() {
		return idNo;
	}

	public void setIdNo(String idNo) {
		this.idNo = idNo;
	}

	public String getSignDate() {
		return signDate;
	}

	public void setSignDate(String signDate) {
		this.signDate = signDate;
	}
	
	public void valid(){
		if(StringUtils.isNotBlank(getSignDate())){
			//如果签约日期不为空，则检验时间格式
			boolean format = DateUtil.isFormat(getSignDate(), DateUtil.FORMAT_DATETIME);
			if(!format){
				throw PayExceptionCode.ERROR_ILL_PARAMETER.expMsg("signDate格式不正确");
			}
		}
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
}
